#include <iostream>
#include <pthread.h>
#include <unistd.h>
using namespace std;

void* ThreadRoutine(void* arg)
{
    const char* threadName = (const char*)arg;
    while(true)
    {
        cout << "I am a new thread "<< threadName << endl;
        sleep(1);
    }
}

int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, ThreadRoutine, (void*)"thread 1");
    while(true)
    {
        cout << "I am main thread" << endl;
        sleep(1);
    }
    return 0;
}